//
//  OMCartPreferentialActivityFooter.m
//  OMENGO
//
//  Created by 梁尚嘉 on 2017/4/20.
//  Copyright © 2017年 Kamfat. All rights reserved.
//

#import "OMCartPreferentialActivityFooter.h"
#import "MainConfigure.h"
@interface OMCartPreferentialActivityFooter ()
@property (nonatomic, strong) UILabel *descLabel;
@property (nonatomic, strong) UILabel *actionLabel;
@property (nonatomic, strong) UIImageView *indicatorImageView;
@end

@implementation OMCartPreferentialActivityFooter
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        [self configure];
    }
    return  self;
}





- (void)configure
{
    self.contentView.backgroundColor = HEXCOLOR(@"#FFF7E9");

    _descLabel = [UILabel new];
    _descLabel.font = SM_CFont(27);
    _descLabel.textColor = SM_blackColor;
    _descLabel.text = @"满19减2元，还差4元";
    [self.contentView addSubview:_descLabel];
    [_descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(SM_SIZE(80)));
        make.centerY.equalTo(self.contentView.mas_centerY);
    }];

    _indicatorImageView = [[UIImageView alloc]initWithImage:[[UIImage imageNamed:@"common_icon_arrow"] imageWithColor:HEXCOLOR(@"#FF7151")]];
    [self.contentView addSubview:_indicatorImageView];
    [_indicatorImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@(SM_SIZE(-25)));
        make.centerY.equalTo(self.contentView.mas_centerY);
    }];

    _actionLabel = [UILabel new];
    _actionLabel.textColor = HEXCOLOR(@"#FF7151");
    _actionLabel.font = SM_CFont(27);
    _actionLabel.text = @"去凑单";
    [self.contentView addSubview:_actionLabel];
    [_actionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(_indicatorImageView.mas_left).offset(SM_SIZE(-12));
        make.centerY.equalTo(self.contentView.mas_centerY);
    }];

    UIView *bottomLine = [UIView new];
    bottomLine.backgroundColor = SM_naviShadowColor;
    [self addSubview:bottomLine];
    [bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.equalTo(@0);
        make.height.equalTo(@.5f);
    }];

    UIView *topLine = [UIView new];
    topLine.backgroundColor = SM_naviShadowColor;
    [self addSubview:topLine];
    [topLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.equalTo(@0);
        make.height.equalTo(@.5f);
    }];

    [self setupTapGusture];

}

- (void)setupTapGusture
{
    self.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]init];
    [self addGestureRecognizer:tap];
    [[tap rac_gestureSignal] subscribeNext:^(id x) {
        NaviPush(@"OMConsumerGoodsViewController", nil);
    }];

}

+ (CGFloat)height
{
    return SM_SIZE(80);
}

+ (NSString *)identifier
{
    return NSStringFromClass(self.class);
}
@end
